#include <limits.h>
#include "mycode.h"
#include <vector>
#include "gtest/gtest.h"
#include <iostream>

using namespace std;

TEST(AddTest, Test1) {

	int i=0;
	int j=0;
	int count=0;
	Matrices A(1,2,3,4);
  	Matrices B(1,2,3,4);
  	int *array1=new int[4];
  	int array2[4]={2,4,6,8};
	Matrices T=A+B;
	for (i=0;i<2;i++)
	{
		for (j=0;j<2;j++)
		{
			
			array1[count]=T.matrix[i][j];
			count++;
		}
	}
	
  	for(i=0;i<4;i++)
	{
		EXPECT_EQ(array1[i], array2[i]);
	}

}

TEST(SubtractTest, Test1) {

	int i=0;
	int j=0;
	int count=0;
	Matrices A(4,3,2,1);
  	Matrices B(1,2,3,4);
  	Matrices T=A-B;
  	int *array1=new int[4];
  	int array2[4]={3,1,-1,-3};
	
	for (i=0;i<2;i++)
	{
		for (j=0;j<2;j++)
		{
			
			array1[count]=T.matrix[i][j];
			count++;
		}
	}
	
  	for(i=0;i<4;i++)
	{
		EXPECT_EQ(array1[i], array2[i]);
	}

}

TEST(MultiplyTest, Test1) {

	int i=0;
	int j=0;
	int count=0;
	Matrices A(1,3,2,4);
  	Matrices B(1,3,2,4);
  	Matrices T=A*B;
  	int *array1=new int[4];
  	int array2[4]={7,15,10,22};
	

	for (i=0;i<2;i++)
	{
		for (j=0;j<2;j++)
		{
			array1[count]=T.matrix[i][j];
			count++;
		}
	}
	
  	for(i=0;i<4;i++)
	{
		EXPECT_EQ(array1[i], array2[i]);
	}

}

TEST(MultiplyandAddTest, Test1) 
{
	int i=0;
	int j=0;
	int count=0;
	Matrices A(7,3,1,2);
  	Matrices B(1,2,3,4);
  	Matrices C(0,6,4,9);
  	int *array1=new int[4];
  	int array2[4]={9,13,29,26};
	Matrices T=A*B+C;
	
	for (i=0;i<2;i++)
	{
		for (j=0;j<2;j++)
		{
			array1[count]=T.matrix[i][j];
			count++;
		}
	}
	
  	for(i=0;i<4;i++)
  	{
  		EXPECT_EQ(array1[i], array2[i]);
  	}
}
